from collections import Counter



# a = {1,2,3}
# b = {3,2,1}
# c = {1,2,3}
#
# a = {1, 2, 3}
# b = {3, 2, 1}
# c = {1, 2, 3}
#
#
# def compare_sets_as_lists(set1, set2):
#     # 将集合转换为列表
#     list1 = list(set1)
#     list2 = list(set2)
#
#     # 比较两个列表的值和顺序
#     if list1 == list2:
#         return 0
#     else:
#         return 1  # 或者其他你认为合适的返回值

a = (1,2,3)
b = (3,2,1)
c = (1,2,3)
d = (1,2)
e = ()
f = ()
def compare_tuples_general(t1, t2):
    """
    :param t1:
    :param t2:
    :return: 1.如果两个元组值相同顺序不同，返回0；
             2.如果两个元组顺序和值都相同，返回1；
             3.如果两个元组值都不相同，返回-1；
             4.如果两个元组为空，返回1。
    """
    if len(t1) != len(t2):
        return -1

    if t1 == t2:
        return 1

    try:
        if sorted(t1) == sorted(t2):
            return 0
    except TypeError:
        # 处理无法排序的情况
        return -1

    return -1


if __name__ == '__main__':
    print(compare_tuples_general(a, b))
    print(compare_tuples_general(a, c))
    print(compare_tuples_general(a, d))
    print(compare_tuples_general(e, f))